import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../style/app_colors.dart';
import '../controllers/dismiss_account_fianl_controller.dart';

class DismissAccountFianlView extends GetView<DismissAccountFianlController> {
  const DismissAccountFianlView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('注销账号'),
        centerTitle: true,
        leading: IconButton(
          icon: Image.asset('assets/images/ic_back2.png',width: 48.w,height: 48.h),
          onPressed: () {
            Get.back();
          },
          tooltip: MaterialLocalizations.of(context).backButtonTooltip, // 可选：设置工具提示
        ),
      ),
      body: Obx(()=>Container(
        padding: EdgeInsets.all(40.w),
        child: Column(
          children: [
            Text('输入账号绑定手机接收的验证码进行验证',
              style: TextStyle(color: AppColors.line_right_character_color, fontSize: 26.sp),),
            SizedBox(height: 40.h),
            Text('${controller.displayPhoneNumber.value}',style: TextStyle(fontSize: 42.sp),),
            SizedBox(height: 40.h),
            Container(
              width: 600.w,
              height: 90.h,
              decoration: BoxDecoration(
                boxShadow: [
                  BoxShadow(
                    color: Colors.black.withOpacity(0.1),
                    spreadRadius: 5,
                    blurRadius: 7,
                    offset: Offset(0, 8.sp), // changes position of shadow
                  ),
                ],
                color:Colors.white,
                borderRadius: BorderRadius.circular(45), // Optional: add border radius
              ),
              child: TextFormField(
                controller: controller.validateCodeController.value,
                decoration: InputDecoration(
                    hintText: '请输入验证码',
                    suffixIcon: GestureDetector(
                      onTap: () {
                        controller.startRequestValidateCode();
                      },
                      child: Container(
                        margin: EdgeInsets.only(top:24.h,right: 36.w),
                        child: Text('${controller.buttonText.value}',style: TextStyle(fontSize: 30.sp,color: Colors.blue)),
                      ),
                    )
                ),
              ),
            ),
            SizedBox(height: 54.h,),
            Container(
              margin: const EdgeInsets.only(top: 50),
              width: 594.w,
              child: ElevatedButton(
                  onPressed: controller.validateCodeController.value.text == '' ? null: () {
                       controller.dismissUserAccount();
                  },
                  child: const Text("确认注销")
              ),
            ),



          ],
        ),
      )),
    );
  }
}
